# 列表[7,-8,5,4,0,-2,-5]排序

# lst1 = [7,-8,5,4,0,-2,-5]
# print(sorted(lst1,key=lambda x:(x<0,abs(x))))


#字符串排序

# s = 'asdf234GDSdsf23'
# def str_sort2(s):
#     for temp in s:
#         if temp.isdigit():
#             if int(temp) % 2 == 0:
#                 return (True, True, temp)
#             else:
#                 return (True, False, temp)
#         else:
#             if temp.isupper():
#                 return (False, True, temp)
#             else:
#                 return (False, False, temp)
# print(sorted(s,key=str_sort2))
# print(''.join(sorted(s, key=str_sort2)))




#用户名规范，并显示

# import re
# username = ["_fdsfsfd","4646466545"]
# def func1(x):
#     if re.findall(r"^[a-zA-Z_]\w{5,17}$",x):
#         return f"{x}符合规范"
#     else:
#         return f"{x}不符合规范"
#
# print(list(map(func1,username)))
# print(list(filter(lambda x:re.findall(r"^[a-zA-Z_]\w{6,17}$",x),username)))





#reduce实现阶乘

# from functools import reduce
# print(reduce(lambda x,y:x*y,range(1,5)))

##被3整除

# print(list(filter(lambda x:x%3==0,range(1,101))))

#求平方

# print(list(map(lambda x:x*x,range(1,11))))



#查找文件中最长行，输出长度


import string
import random
# with open('big.data','w+', encoding="utf-8") as fp:
#      fp.write('aaaaaaaaaaaaaaaaaa\n' * 10**7)
#      fp.write(("".join(random.choices(string.ascii_lowercase,k = random.randint(1, 50)))+"\n"))
#
# with open('big.data', 'r') as f:
#     long = 0
#     all = (x for x in f.readlines())
#     for line in all:
#         linelen = len(line)
#         if not linelen:
#             break
#         if linelen > long:
#             long = linelen
#
# print(long)

















